<template>
  <component
    :is="comps[name]"
    v-bind="{ ...$attrs, ...allStaticMetaConfig }"
    v-if="!isDesignerLayoutCanvas"
  ></component>
  <BizDesignerLayoutBizcomp v-else v-bind="$attrs"></BizDesignerLayoutBizcomp>
</template>
<script>
  export default {
    name: "BizDynmicCompSimple",
  };
</script>
<script setup>
  import { computed } from "vue";
  import BizDesignerLayoutBizcomp from "@gd-accbuild-ui/biz-ui/biz-designer-layout-bizcomp/pc/src";
  import BizSearchformTablelistSimple from "@gd-accbuild-ui/biz-ui/biz-searchform-tablelist-simple/pc/src";
  import BizCustomizeSimple from "@gd-accbuild-ui/biz-ui/biz-customize-simple/pc/src";

  const props = defineProps({
    name: {
      type: String,
      require: true,
    },
    isDesignerLayoutCanvas: {
      type: Boolean,
      default: false,
    },
    staticMetaConfigs: {
      type: Array,
      default: () => [],
    },
  });
  const comps = {
    BizSearchformTablelistSimple,
    BizCustomizeSimple,
  };
  const allStaticMetaConfig = computed(() => {
    return props.staticMetaConfigs.length === 1 ? props.staticMetaConfigs[0] : {};
  });
  /* const _emits = defineEmits(["biz-designer-layout-bizcomp:blank:actived"]);
  const onBizDesignerLayoutBizcompActived = () => {
    console.log('-----')
    _emits("biz-designer-layout-bizcomp:blank:actived");
  }; */
</script>
